public var remLife: float = 35.0;
public var bazFX: Transform;

/*function OnDrawGizmos () {
	Gizmos.DrawSphere (transform.position, 5.0);
}*/

function OnTriggerEnter (collision: Collider){
	if(collision.transform.gameObject.tag=="Enemy"){
		collision.transform.GetComponent(GameBotBehaviour).RemLife(100);
		Instantiate(bazFX,transform.position,transform.rotation);
		DestroyBots();
		Destroy(gameObject);
	}else{
		if(collision.transform.gameObject.tag!="Bullet"){
	//Destroy(collision.transform.gameObject);
			var bazukeBoom:Transform = Instantiate(bazFX,transform.position,transform.rotation);
			DestroyBots();
			Destroy(gameObject);
		}
	}
}
function DestroyBots() {
	var bots:Array = GameObject.FindGameObjectsWithTag("Enemy");
	for(var i:int = 0; i<bots.length; i++){
		var dist = Mathf.Sqrt(Mathf.Pow(bots[i].transform.position.x-transform.position.x,2)+Mathf.Pow(bots[i].transform.position.z-transform.position.z,2));
		if(dist<=4.0){
			bots[i].GetComponent(GameBotBehaviour).RemLife(150);
		}
	}
}
function Start() {
	rigidbody.AddForce(transform.TransformDirection(Vector3.forward)*6);
}
public var target:Transform;
function Update () {
	if(!target){
		return;
	}
	var dist:float = Vector3.Distance(transform.position,target.position);
	if(dist>40){
		Destroy(gameObject);
	}
	
}